package com.appwoo.txtws.adapter;

import android.content.Intent;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.appwoo.txtws.activity.BookReaderQuestionActivity;
import com.appwoo.txtws.activity.BookmarkActivity;
import com.appwoo.txtws.bean.BookmarkBean;
import java.util.ArrayList;

public class BookmarkAdapter extends BaseAdapter
{
  private ArrayList<BookmarkBean> bookmarks;
  private BookmarkActivity context;
  private int firstExtra;
  private int height;
  private LayoutInflater inflater;
  private View.OnClickListener layoutOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      BookmarkAdapter.ViewHolderSyncTutorialBookmark localViewHolderSyncTutorialBookmark = (BookmarkAdapter.ViewHolderSyncTutorialBookmark)paramAnonymousView.getTag();
      Intent localIntent = new Intent(BookmarkAdapter.this.context, BookReaderQuestionActivity.class);
      localIntent.putExtra("bookmarkId", localViewHolderSyncTutorialBookmark.bookmark.getBookmarkId());
      localIntent.putExtra("readerType", "bookmark");
      BookmarkAdapter.this.context.startActivity(localIntent);
    }
  };
  private View.OnLongClickListener layoutOnLongClickListener = new View.OnLongClickListener()
  {
    public boolean onLongClick(View paramAnonymousView)
    {
      BookmarkAdapter.ViewHolderSyncTutorialBookmark localViewHolderSyncTutorialBookmark = (BookmarkAdapter.ViewHolderSyncTutorialBookmark)paramAnonymousView.getTag();
      BookmarkAdapter.this.context.showLongClickDialog(localViewHolderSyncTutorialBookmark.bookmark);
      return false;
    }
  };

  public BookmarkAdapter(BookmarkActivity paramBookmarkActivity, ArrayList<BookmarkBean> paramArrayList, DisplayMetrics paramDisplayMetrics, int paramInt1, int paramInt2)
  {
    this.context = paramBookmarkActivity;
    this.bookmarks = paramArrayList;
    this.height = paramInt1;
    this.firstExtra = paramInt2;
    this.inflater = ((LayoutInflater)paramBookmarkActivity.getSystemService("layout_inflater"));
  }

  public int getCount()
  {
    return this.bookmarks.size();
  }

  public Object getItem(int paramInt)
  {
    return null;
  }

  public long getItemId(int paramInt)
  {
    return paramInt;
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    BookmarkBean localBookmarkBean = (BookmarkBean)this.bookmarks.get(paramInt);
    ViewHolderSyncTutorialBookmark localViewHolderSyncTutorialBookmark;
    if (paramView == null)
    {
      paramView = this.inflater.inflate(2130903062, null);
      localViewHolderSyncTutorialBookmark = new ViewHolderSyncTutorialBookmark(null);
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkId = ((TextView)paramView.findViewById(2131492976));
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkUnit = ((TextView)paramView.findViewById(2131492978));
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkModule = ((TextView)paramView.findViewById(2131492977));
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkTime = ((TextView)paramView.findViewById(2131492979));
      paramView.setTag(localViewHolderSyncTutorialBookmark);
      if (paramInt != 0)
        break label309;
      paramView.setLayoutParams(new AbsListView.LayoutParams(-1, this.height + this.firstExtra));
    }
    while (true)
    {
      if (localBookmarkBean == null)
        break label328;
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkId.setVisibility(0);
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkModule.setVisibility(0);
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkUnit.setVisibility(0);
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkTime.setVisibility(0);
      localViewHolderSyncTutorialBookmark.bookmark = localBookmarkBean;
      paramView.setOnClickListener(this.layoutOnClickListener);
      paramView.setOnLongClickListener(this.layoutOnLongClickListener);
      String str = String.valueOf(paramInt + 1) + ".";
      if (paramInt + 1 < 10)
        str = "0" + str;
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkId.setText(str);
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkModule.setText(localBookmarkBean.getModulename());
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkUnit.setText(localBookmarkBean.getUnitname());
      localViewHolderSyncTutorialBookmark.syncTutorialBookmarkTime.setText(BookmarkActivity.timeMillisToString(localBookmarkBean.getAddTime()));
      return paramView;
      localViewHolderSyncTutorialBookmark = (ViewHolderSyncTutorialBookmark)paramView.getTag();
      break;
      label309: paramView.setLayoutParams(new AbsListView.LayoutParams(-1, this.height));
    }
    label328: localViewHolderSyncTutorialBookmark.syncTutorialBookmarkId.setVisibility(4);
    localViewHolderSyncTutorialBookmark.syncTutorialBookmarkModule.setVisibility(4);
    localViewHolderSyncTutorialBookmark.syncTutorialBookmarkUnit.setVisibility(4);
    localViewHolderSyncTutorialBookmark.syncTutorialBookmarkTime.setVisibility(4);
    paramView.setOnClickListener(null);
    paramView.setOnLongClickListener(null);
    return paramView;
  }

  public void setData(ArrayList<BookmarkBean> paramArrayList)
  {
    this.bookmarks = paramArrayList;
  }

  private class ViewHolderSyncTutorialBookmark
  {
    BookmarkBean bookmark;
    TextView syncTutorialBookmarkId;
    TextView syncTutorialBookmarkModule;
    TextView syncTutorialBookmarkTime;
    TextView syncTutorialBookmarkUnit;

    private ViewHolderSyncTutorialBookmark()
    {
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.adapter.BookmarkAdapter
 * JD-Core Version:    0.6.2
 */